package com.sairobo.admin.modules.wechat.util;

import com.sairobo.base.common.utils.PropertyUtils;
import net.sf.json.JSONObject;

import java.io.IOException;
import java.util.ResourceBundle;

/**
 * 微信工具类
 */
public final class WechatUtil extends PropertyUtils {
    private static ResourceBundle resourceBundle;
    protected ResourceBundle getResource() {
        if (resourceBundle != null) {
            return resourceBundle;
        }else {
            //eq:"config/eureka"
            resourceBundle = ResourceBundle.getBundle("config/wechat");
        }
        return resourceBundle;
    }

    public static WechatUtil instance;
    public static String APPID;
    public static String APPSECRET;

    static {
        instance = new WechatUtil();
        WechatUtil.APPID = instance.getMessage("wechat.appid");
        WechatUtil.APPSECRET = instance.getMessage("wechat.appsecret");
    }

    /**
     * DefaultHttpClient 已过时
     *
     * @param url
     * @return
     * @throws IOException
     */
    public static JSONObject doGetJson(String url) throws IOException {
        return HttpClientUtil.get(url);
    }
}
